using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.Serialization;

namespace KPIS.GERP.Models.BGM
{
	[Table("bgm_mas_expense"), DataContract]
    public class MasBudgetExpense
    {
        public MasBudgetExpense()
        {
            LowerMasBudgetExpense = new HashSet<MasBudgetExpense>();
        }

		[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        [DataMember, Display(Name = "BgExpId", ResourceType = typeof(Resources.MasBudgetExpenseResource))]
		[Column("bgm_exp_seq", TypeName="int")]
        public int BgExpId { get; set; }

		[DataMember, Display(Name = "Code", ResourceType = typeof(Resources.MasBudgetExpenseResource))]
		[Column("bgm_exp_code", TypeName="ntext")]
        public string Code { get; set; }

		[DataMember, Display(Name = "Name", ResourceType = typeof(Resources.MasBudgetExpenseResource))]
		[Column("bgm_exp_name", TypeName="ntext")]
        public string Name { get; set; }

		[DataMember, Display(Name = "Descr", ResourceType = typeof(Resources.MasBudgetExpenseResource))]
		[Column("bgm_exp_descr", TypeName="ntext")]
        public string Descr { get; set; }

        [ForeignKey("UpperMasBudgetExpense")]
		[DataMember, Display(Name = "UpperBgExpId", ResourceType = typeof(Resources.MasBudgetExpenseResource))]
		[Column("upper_bgm_exp_seq", TypeName="int")]
        public int? UpperBgExpId { get; set; }

        [ForeignKey("MasBudgetExpenseGroup")]
		[DataMember, Display(Name = "BgExpGrpId", ResourceType = typeof(Resources.MasBudgetExpenseResource))]
		[Column("bgm_exp_grp_seq", TypeName="int")]
        public int? BgExpGrpId { get; set; }

        [ForeignKey("MasBudgetExpenseGroupReal")]
        [DataMember, Display(Name = "BgExpGrpIdReal", ResourceType = typeof(Resources.MasBudgetExpenseResource))]
		[Column("bgm_exp_grp_id_real", TypeName="int")]
        public Nullable<int> BgExpGrpIdReal { get; set; }

		[ForeignKey("Account")]
		[DataMember, Display(Name = "AccountId", ResourceType = typeof(Resources.MasBudgetExpenseResource))]
		[Column("account_seq", TypeName="int")]
        public Nullable<int> AccountId { get; set; }

		[DataMember, Display(Name = "ResId", ResourceType = typeof(Resources.MasBudgetExpenseResource))]
		[Column("icm_resource_seq", TypeName="int")]
        public Nullable<int> IcmResourceId { get; set; }

		[DataMember, Display(Name = "ResType", ResourceType = typeof(Resources.MasBudgetExpenseResource))]
		[Column("icm_resource_type", TypeName="ntext")]
        public string IcmResourceType { get; set; }

		[DataMember, Display(Name = "GfmisCode", ResourceType = typeof(Resources.MasBudgetExpenseResource))]
		[Column("gfmis_code", TypeName="ntext")]
        public string GfmisCode { get; set; }

        [DataMember]
		public virtual MasBudgetExpense UpperMasBudgetExpense { get; set; }

        [DataMember]
        public virtual MasBudgetExpenseGroup MasBudgetExpenseGroup { get; set; }

        [DataMember]
        public virtual MasBudgetExpenseGroup MasBudgetExpenseGroupReal { get; set; }

        [DataMember]
		public virtual ACM.MasAccount Account { get; set; }

        [DataMember]
        public virtual ICollection<MasBudgetExpense> LowerMasBudgetExpense { get; set; }

        #region RecordStatus

        [DataMember, Display(Name = "RecordStatus", ResourceType = typeof(SYS.Resources.RecordStatusResource))]
		[Column("record_status", TypeName="ntext")]
        public string RecordStatus { get; set; }

        [DataMember, Display(Name = "CreatedBy", ResourceType = typeof(SYS.Resources.RecordStatusResource))]
		[Column("created_by", TypeName="int")]
        public Nullable<int> CreatedBy { get; set; }

        [DataMember, Display(Name = "CreatedWhen", ResourceType = typeof(SYS.Resources.RecordStatusResource))]
		[Column("created_when", TypeName="datetime2")]
        public Nullable<System.DateTime> CreatedWhen { get; set; }

        [DataMember, Display(Name = "UpdatedBy", ResourceType = typeof(SYS.Resources.RecordStatusResource))]
		[Column("updated_by", TypeName="int")]
        public Nullable<int> UpdatedBy { get; set; }

        [DataMember, Display(Name = "UpdatedWhen", ResourceType = typeof(SYS.Resources.RecordStatusResource))]
		[Column("updated_when", TypeName="datetime2")]
        public Nullable<System.DateTime> UpdatedWhen { get; set; }

        #endregion

    }
}